ggplot(data = df, aes(x = `Incremental QALY``, y = `Incremental costs`) +
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`) +
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`) +
geom_point()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-3,3)) +
ylim(c(-75000,75000)) +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-3:3)) +
ylim(c(-75000:75000)) +
theme_bw()
?xlim
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-3,3)) +
ylim(c(-75000,75000)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
#xlim(c(-3,3)) +
#ylim(c(-75000,75000)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black")
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
#xlim(c(-3,3)) +
#ylim(c(-75000,75000)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-3,3)) +
#ylim(c(-75000,75000)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
#xlim(c(-3,3)) +
ylim(c(-75000,75000)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
xlims <- 3
ylims <- 75000
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
xlims <- as.numeric(3)
ylims <- as.numeric(75000)
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
mode(xlims)
class(xlims)
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
scale_y_continuous(labels = dollar_format(prefix = "\u20ac ", suffix = ""),
limits = c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
scale_y_continuous(labels = dollar_format(prefix = "", suffix = ""),
limits = c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
scale_y_continuous(labels = dollar_format(prefix = "euros ", suffix = ""),
limits = c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
library(scales)
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
scale_y_continuous(labels = dollar_format(prefix = "euros ", suffix = ""),
limits = c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
df
mode(df[,2])
class(df[,2])
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Incremental costs" = as.numeric(c(10000,50000)),
"Incremental QALY" = c(rep(2,2))))
class(df[,2])
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Incremental costs" = as.numeric(as.character(c(10000,50000))),
"Incremental QALY" = as.numeric(as.character(c(rep(2,2))))))
class(df[,2])
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Incremental costs" = as.integer(c(10000,50000)),
"Incremental QALY" = c(rep(2,2))))
class(df[,2])
df[,2] <- as.numeric(df[,2])
class(df[,2])
mode(df[,2])
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Incremental costs" = c(10000,50000),
"Incremental QALY" = c(rep(2,2))))
df[,2] <- as.numeric(df[,2])
df[,3] <- as.numeric(df[,3])
xlims <- as.numeric(3)
ylims <- as.numeric(75000)
ggplot(data = df, aes(x = `Incremental QALY`, y = `Incremental costs`)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Inc.costs" = c(10000,50000),
"Inc.QALY" = c(rep(2,2))))
df[,2] <- as.numeric(df[,2])
df[,3] <- as.numeric(df[,3])
xlims <- as.numeric(3)
ylims <- as.numeric(75000)
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
df$Inc.costs
df$Inc.QALY
df <- as.data.frame(cbind("Intervention" = c("A","B"),
"Inc.costs" = c(10000,50000),
"Inc.QALY" = c(rep(2,2))))
df[,2] <- as.numeric(as.character(df[,2]))
df[,3] <- as.numeric(as.character(df[,3]))
xlims <- as.numeric(3)
ylims <- as.numeric(75000)
df$Inc.costs
df$Inc.QALY
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 80000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
theme_bw()
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_vline(yintercept = 2, linetype="dashed",
color = "orange") +
theme_bw()
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_vline(xintercept = 2, linetype="dashed",
color = "orange") +
theme_bw()
?geom_vline
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_vline(xintercept = 2, linetype="dashed",
color = "orange", ylim(0,50000)) +
theme_bw()
?geom_line
c(0:50000)
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_line(aes(x = rep(2,50001), y = c(0:50000)), linetype="dashed",
color = "orange") +
theme_bw()
rep(2,50001)
c(0:50000)
xx <- rep(2,50001)
yy <- c(0:50000)
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_line(aes(x = xx, y = yy), linetype="dashed",
color = "orange") +
theme_bw()
df2 <- as.data.frame(cbind(xx == rep(2,50001),
yy <- c(0:50000)))
ggplot(data = df, aes(x = Inc.QALY, y = Inc.costs)) +
geom_point() +
xlim(c(-xlims,xlims)) +
ylim(c(-ylims,ylims)) +
xlab ("Incremental QALY") +
ylab("Incremental costs") +
geom_hline(yintercept = 0, linetype="dashed",
color = "red") +
geom_vline(xintercept = 0, linetype="dashed",
color = "red") +
geom_abline(intercept = 0, slope = 20000, linetype= "dotted",
color = "black") +
geom_line(data = df2, aes(x = xx, y = yy), linetype="dashed",
color = "orange") +
theme_bw()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
knitr::opts_chunk$set(message = FALSE)
rm(list = ls())  # delete everything that is in R's memory
options(scipen=1000) # removal of scientific notation
setwd("H:/Papers/CEA Eribulin/Model final/report") # set working directory to File Source
# load functions
source("H:/Papers/CEA Eribulin/Model final/R/01_fun_analyses.R")
source("H:/Papers/CEA Eribulin/Model final/R/03_fun_dowsa.R")
source("H:/Papers/CEA Eribulin/Model final/R/03_fun_scenarios.R")
source("H:/Papers/CEA Eribulin/Model final/R/03_fun_psa_inputs.R")
source("H:/Papers/CEA Eribulin/Model final/R/03_fun_threshold.R")
# load model inputs
load("H:/Papers/CEA Eribulin/Model final/data/01_model_inputs.R")
l.det.res <- CEModel_det(params = params_det) # run the function
.libPaths("H:/R/win-library/3.1") # set library path
l.det.res <- CEModel_det(params = params_det) # run the function
library(rms)
library(survival)
library(muhaz)
library(survminer)
library(ggplot2)
library(data.table)
library(printr)
library(dplyr)
library(flexsurv)
library(plyr)
library(tidyverse)
library(scales)
library(matrixStats)
library(reshape2)
l.params_prob <- generate_psa_inputs(n.sim = n.sim, seed.num = seed.num)
m.prob.res <- CEModel_prob(params = l.params_prob, n.sim = n.sim) # provides a matrix with the results of each iteration (10,000 in our analysis)
dfprob <- as.data.frame(m.prob.res)#transform output in dataframe
df_evpi2 <- evpi(v.wtp = v.wtp, m.e = cbind(dfprob$TQ_disc.trt-dfprob[,ncol(dfprob)]*0.85, dfprob$TQ_disc.comp), m.c = cbind(dfprob$TC_disc.trt, dfprob$TC_disc.comp))
df_evpi2[which(df_evpi2$WTP == 80000),]
head(df_evpi2)
ggplot(data = df_evpi2[which(df_evpi2$WTP<110000),], aes(x = WTP , y = EVPI)) +
#geom_point() +
geom_line() +
scale_x_continuous(labels = dollar_format(prefix = "\u20ac ", suffix = ""), breaks = number_ticks(10), limits = c(0,100000)) +
scale_y_continuous(labels = dollar_format(prefix = "\u20ac ", suffix = ""), breaks = number_ticks(6)) +
xlab("Willingness-to-pay (\u20ac/QALY)") +
ylab("EVPI (\u20ac/ per patient)") +
theme_bw(base_size = 10) +
theme(legend.position="bottom")
round(((mean(dfprob$TQ_disc.comp) - mean(dfprob[,ncol(dfprob)])*0.85)* wtp - mean(dfprob$TC_disc.comp)) - (mean(dfprob$TQ_disc.trt) * wtp - mean(dfprob$TC_disc.trt)),0)
df_evpi2 <- evpi(v.wtp = v.wtp, m.e = cbind(dfprob$TQ_disc.trt, dfprob$TQ_disc.comp), m.c = cbind(dfprob$TC_disc.trt-dfprob[,ncol(dfprob)]*0.85, dfprob$TC_disc.comp))
df_evpi2[which(df_evpi2$WTP == 80000),]
ggplot(data = df_evpi2[which(df_evpi2$WTP<110000),], aes(x = WTP , y = EVPI)) +
#geom_point() +
geom_line() +
scale_x_continuous(labels = dollar_format(prefix = "\u20ac ", suffix = ""), breaks = number_ticks(10), limits = c(0,100000)) +
scale_y_continuous(labels = dollar_format(prefix = "\u20ac ", suffix = ""), breaks = number_ticks(6)) +
xlab("Willingness-to-pay (\u20ac/QALY)") +
ylab("EVPI (\u20ac/ per patient)") +
theme_bw(base_size = 10) +
theme(legend.position="bottom")
round((mean(dfprob$TQ_disc.comp) * wtp - mean(dfprob$TC_disc.comp)) - (mean(dfprob$TQ_disc.trt) * wtp - mean(dfprob$TC_disc.trt)),0)
round((mean(dfprob$TQ_disc.comp) * wtp - mean(dfprob$TC_disc.comp)) - (mean(dfprob$TQ_disc.trt) * wtp - (mean(dfprob$TC_disc.trt)-mean(dfprob[,ncol(dfprob)])*0.85)),0) #PSB at 80,000
scal.inci.pt   <- 14882 	#number of incident patients in 2018: https://www.iknl.nl/nkr-cijfers?fs%7Cepidemiologie_id=7&fs%7Ctumor_id=369&fs%7Cregio_id=135&fs%7Cgedrag_id=12&fs%7Cperiode_id=86%2C87%2C88%2C89%2C90%2C91%2C92%2C93%2C94%2C95%2C96%2C97%2C98%2C99%2C100%2C101%2C102%2C103%2C104%2C105%2C106%2C107%2C108%2C109%2C110%2C111%2C112%2C113%2C114%2C115&fs%7Cgeslacht_id=16&fs%7Cleeftijdsgroep_id=76%2C40%2C41%2C42%2C43%2C44%2C45&fs%7Cjaren_na_diagnose_id=18&fs%7Ceenheid_id=2&cs%7Ctype=column&cs%7CxAxis=periode_id&cs%7Cseries=leeftijdsgroep_id&ts%7CrowDimensions=periode_id&ts%7CcolumnDimensions=leeftijdsgroep_id&lang%7Clanguage=nl
scal.pr.i.abc  <- 0.05    #proportion metastatic patients at diagnosis ("incident" advanced breast cancer (ABC)  patients): https://www.zorginstituutnederland.nl/publicaties/adviezen/2017/04/11/pakketadvies-palbociclib
scal.pr.d.abc <- 0.2    #proportion of patients who will develop ABC: https://www.zorginstituutnederland.nl/publicaties/adviezen/2017/04/11/pakketadvies-palbociclib
scal.num.pt <- ceiling(scal.inci.pt*scal.pr.i.abc + scal.inci.pt*(1-scal.pr.i.abc)*scal.pr.d.abc) # total number of ABC patients
scal.pr.eli.eri <- (45+74)/721 #proportion of eligible patients for eribulin in the entire population since the introduction of eribulin
scal.eri <- 15/32 # proportion of eligible patients who actually received eribulin after 01-01-2016 (15 is the number of patients who received eribulin, 32 is the number of eligible patients)
scal.eli.pop  <- scal.num.pt*scal.pr.eli.eri
scal.eli.pop
df_evpi2[which(df_evpi2$WTP == 80000),]*scal.eli.pop
df_evpi2[which(df_evpi2$WTP == 80000),"EVPI"]*scal.eli.pop
# load model inputs
load("H:/Papers/CEA Eribulin/Model final/data/01_model_inputs.R")
View(ru.eri.vials)
.libPaths("H:/R/win-library/3.1")
library(bookdown)
# load model inputs
load("H:/Papers/CEA Eribulin/Model final/data/01_model_inputs.R")
str(df.os)
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
.libPaths("H:/R/win-library/3.1")
library(bookdown)
tinytex:::is_tinytex()
# load model inputs
load("H:/Papers/CEA Eribulin/Model final/data/01_model_inputs.R")
View(df.ttd)
# load model inputs
load("H:/Papers/CEA Eribulin/Model final/data/01_model_inputs.R")
View(df.ttd)
.libPaths("H:/R/win-library/3.1")
library(bookdown)
.libPaths("H:/R/win-library/3.1")
install.packages('geometry')
install.packages('float')
install.packages('setspace')
library('geometry')
library('float')
library('setspace')
.libPaths("H:/R/win-library/3.1")
library(bookdown)
path <- "H:/Papers/CEA Eribulin/Model final/" #set location of model, to adapt!
setwd(paste(path,"report", sep = "")) # set working directory to File Source
.libPaths("H:/R/win-library/3.1") # set library path
source(paste(path,"R/01_fun_analyses.R", sep = ""))
source(paste(path,"R/03_fun_dowsa.R", sep = ""))
source(paste(path,"R/03_fun_scenarios.R", sep = ""))
source(paste(path,"R/03_fun_psa_inputs.R", sep = ""))
source(paste(path,"R/03_fun_threshold.R", sep = ""))
# load model inputs
load(paste(path,"data/01_model_inputs.R", sep = ""))
l.det.res <- CEModel_det(params = params_det) # run the function
library(rms)
library(survival)
library(muhaz)
library(survminer)
library(ggplot2)
library(data.table)
library(printr)
library(dplyr)
library(flexsurv)
library(tidyverse)
library(scales)
library(matrixStats)
library(reshape2)
l.det.res <- CEModel_det(params = params_det) # run the function
# we will reorganise the undiscounted output so that it looks nice
df.und.det.res <- l.det.res[[2]] # export results from the list to a separate dataframe
df.und.det.res
as.numeric(as.character(l.det.res[[1]][1,"Inc.QALY"])) *
wtp - as.numeric(as.character(l.det.res[[1]][1,"Inc.Costs"]))
# original value of output
base.value <- as.numeric(as.character(l.det.res[[1]][1,"Inc.QALY"])) * wtp - as.numeric(as.character(l.det.res[[1]][1,"Inc.Costs"]))
base.value
# original value of output
base.value <- as.numeric(as.character(l.det.res[[1]][1,"Inc.QALY"])) *
wtp - as.numeric(as.character(l.det.res[[1]][1,"Inc.Costs"]))
base.value
install.packages('longtable')
library('longtable')
